package com.apes.fn.business.carAccident.modle;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.frame.model.Dept;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName WorkOrderOperationRecord
 * @Author wsj
 * @Date 2021/6/4 11:28
 * @description 定损工单操作记录
 */
@Entity
@EntityListeners(DefaultPersistListener.class)
@Getter
@Setter
@DynamicUpdate
@DynamicInsert
@SelectBeforeUpdate
@Table(name = WorkOrderOperationRecord.CONST_TABLE_NAME)
public class WorkOrderOperationRecord extends BaseModel {
    public static final String CONST_TABLE_NAME = "work_order_operation_record";

    @Id
    @Column(name = "id", nullable = false, length = 6)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "定损工单操作纪路")
    @Comment("序列")
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "claim_Work_Order",referencedColumnName = "id")
    @Comment("定损工单号")
    private ClaimWorkOrder claimWorkOrder;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id", referencedColumnName = "id", nullable = false)
    @Comment("门店")
    private Dept dept;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "operator", referencedColumnName = "id")
    @Comment("操作人")
    private PartyRole operator;

    @Column(name = "operator_Name", length = 64)
    @Comment("操作人名")
    private String operatorName;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "operation_Date")
    @Comment("操作时间")
    private Date operationDate;

    @Column(name = "operation_Type", length = 64)
    @Comment("操作类型")
    private String operationType;

    @Column(name = "remark", length = 128)
    @Comment("备注")
    private String remark;

}
